export const apiKey = 'DWLBZ-ZYY63-DF73E-RKK5V-MO3AV-3LBFF'; // 替换为你自己的腾讯地图API密钥

export function mapQQget(mode = '', key = '', api = '') {
	return new Promise((resolve, reject) => {
		if (!mode || !api) {
			return reject('请输入mode和api')
		}
		const url = `https://apis.map.qq.com/ws/${mode}/v1/${key}?${api}&key=${apiKey}`;
		uni.request({
			url: url,
			method: 'GET',
			header: {
				'content-type': 'application/json' // 默认值
			},
			success: (res) => {
				if (res.data.status == 0) {
					resolve(res.data);
				} else {
					uni.showToast({
						title: res.data.message,
						icon: 'none'
					})
					reject(res.data.message);
				}
			},
			fail: (err) => {
				reject(err);
			}
		});
	})
}